import { _decorator, Component } from 'cc';
import { ItemUI } from './ItemUI';
import { InventoryManager } from './InventoryManager';
const { ccclass, property } = _decorator;

export enum SlotType {
    BAG,
    WEAPON,
    ARMOR,
    ACTION
}

@ccclass('ItemUI')
export class SlotHolder extends Component {

    slotType: SlotType

    itemUI: ItemUI

    public UpdateItem() {
        switch (this.slotType) {
            case SlotType.BAG:
                this.itemUI.bag = InventoryManager.Instance.inventoryData
                break;
            case SlotType.WEAPON:
                this.itemUI.equipment = InventoryManager.Instance.equipmentData
                break;
            case SlotType.ARMOR:
                break;
            case SlotType.ACTION:
                this.itemUI.action = InventoryManager.Instance.actionData
                break;
        }

        let item = this.itemUI.bag.items[this.itemUI.index]
        this.itemUI.SetupItemUI(item.itemData, item.amount)
    }

}